package com.taotao.controller;

import com.taotao.entity.User;
import com.taotao.feign.LoginFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wangjin
 * @title: IndexController
 * @projectName wj-sc
 * @description:
 * @date 2021/10/27 9:15
 */
@RestController
public class IndexController {
    @Autowired
    private LoginFeignService loginFeignService;
    @Value("${server.port}")
    private String sport;

    @RequestMapping("/index")
    public String index() {
        return loginFeignService.login();
    }

    //String 类型传值通过feign传递
    @RequestMapping("/getOrderName")
    public String getOrderName(String name) {
        return loginFeignService.getName(name);
    }

    /**
     * feign 多个参数传值
     *
     * @param name
     * @param pass
     * @return
     */

    @RequestMapping("/getOrderNameMore")
    public String getOrderNameMore(String name, String pass) {
        return loginFeignService.getNameMore(name, pass);
    }


    /**
     * feign 传递 model 类型的值
     *
     * @param user
     * @return
     */

    @RequestMapping("/getuserOrder")
    public String user(User user) {
        return loginFeignService.getUser(user);
    }
}
